import {
  BaseEntity,
  Column,
  Entity,
  PrimaryColumn,
  PrimaryGeneratedColumn,
} from 'typeorm'

@Entity({ name: 'role' })
export class Role extends BaseEntity {
  // 自增主键
  @PrimaryGeneratedColumn({ type: 'int', name: 'id' })
  id: number

  // 角色名称
  @PrimaryColumn({
    type: 'varchar',
    name: 'roleName',
  })
  roleName: string

  // 角色编码
  @Column({
    type: 'varchar',
    name: 'roleCode',
  })
  roleCode: string

  // 状态 正常还是停用
  @Column({
    type: 'tinyint',
    name: 'validFlag',
  })
  validFlag: boolean

  // 备注
  @Column({
    type: 'varchar',
    name: 'remark',
    nullable: true,
  })
  remark: string

  // 排序
  @Column({
    type: 'int',
    name: 'sortOrder',
  })
  sortOrder: number

  // 权限id数组
  @Column({
    type: 'varchar',
    name: 'menuIds',
    nullable: true,
  })
  menuIds: string

  // 是否删除
  @Column({
    type: 'tinyint',
    name: 'isDelete',
    nullable: true,
  })
  isDelete: boolean
}
